#include <stdio.h>

int main(){
    int time;
    int num;
    int count;
    int result[time];
    scanf("%d",&time);
    for (int i=0;i<time;i++){
        scanf("%d",&num);
        count=0;
        while (num!=0){
            if (num%2==1){
                count++;
            }
            num=num/2;
        }
        result[i]=count;

    }
    for (int i=0;i<time;i++){printf("%d\n",result[i]);}
    return 0;
}